﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Netfraction.Common.Logging
{
    public class DataSource
    {
        public string Name { get; set; }
        public Guid Guid { get; set; } // can generate with GuidGen from Windows SDK, via C# code, or at http://www.guidgen.com/
        public string Version { get; set; }
        public string Author { get; set; }
        public string SiteUrl { get; set; }
        public string UpdateUrl { get; set; }
        public string SourceLicence { get; set; }
    }

    public static class LogDataSource
    {
        private static DataSource _dataSource;

        private static void CreateDataSource()
        {
            if (_dataSource != null)
                return;

            Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            _dataSource = new DataSource();

            _dataSource.Name = "Logging";
            _dataSource.Version = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", curVersion.Major, curVersion.Minor);
            _dataSource.Guid = new Guid("c8b52a2c-6ecb-4df6-95aa-b1be13b5034d");
            _dataSource.Author = "darkKlor";
            _dataSource.SourceLicence = "GPL v2.0";
            _dataSource.UpdateUrl = "";
            _dataSource.SiteUrl = "http://netfraction.codeplex.com/";
        }

        public static DataSource Source
        {
            get
            {
                if (_dataSource == null)
                    CreateDataSource();

                return _dataSource;
            }
        }
    }
}
